package com.yocard.yxyd.http;

import com.google.gson.JsonObject;
import com.yocard.yxyd.BuildConfig;
import com.yocard.yxyd.http.model.response.BannerBean;
import com.yocard.yxyd.http.model.response.CertStatusBean;
import com.yocard.yxyd.http.model.response.CoinsBean;
import com.yocard.yxyd.http.model.response.CommonBean;
import com.yocard.yxyd.http.model.response.CsmOrderDetailBean;
import com.yocard.yxyd.http.model.response.CsmOrderListBean;
import com.yocard.yxyd.http.model.response.CsmPayInfo;
import com.yocard.yxyd.http.model.response.InviteRecord;
import com.yocard.yxyd.http.model.response.InviteResponse;
import com.yocard.yxyd.http.model.response.OrderPayResponseBean;
import com.yocard.yxyd.http.model.response.PushSettingBean;
import com.yocard.yxyd.http.model.response.TopOrderBean;
import com.yocard.yxyd.http.model.response.OrderListBean;
import com.yocard.yxyd.http.model.response.RechargesBean;
import com.yocard.yxyd.http.model.base.Response;
import com.yocard.yxyd.http.model.response.TrackListBean;
import com.yocard.yxyd.http.model.response.UpdateBean;
import com.yocard.yxyd.http.model.response.UserInfoBean;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.List;
import java.util.Map;

import io.reactivex.Flowable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface Api {

    String BASE_URL = BuildConfig.HOST;

    @GET("api/v/1.0/realname/getRealname")
    Flowable<Response<CommonBean>> getRealName();

    @POST("api/v/1.0/my/head/{id}")
    Flowable<Response<JSONObject>> addAvatorId(@Path("id") String id);

    @GET("api/v/1.0/version")
    Flowable<Response<UpdateBean>> getUpdateInfo(@Query("version") int versionCode, @Query("os") String os);

    @POST("api/v/1.0/set/change_mobile")
    Flowable<Response<List<Object>>> changeMobile(@Body JsonObject jsonObject);

    @POST("api/v/1.0/set/get_code_new")
    Flowable<Response<JsonObject>> getNewMobileCode(@Body JsonObject jsonObject);

    @POST("api/v/1.0/set/push_code_old")
    Flowable<Response<List<Object>>> pushOldcode(@Body JsonObject jsonObject);

    @POST("api/v/1.0/set/get_code_old")
    Flowable<Response<List<Object>>> getOldMObileCode(@Body JsonObject jsonObject);

    @GET("api/v/1.0/realname/get_status")
    Flowable<Response<CertStatusBean>> getCertStatus();

    @POST("api/v/1.0/realname")
    Flowable<Response<List<Object>>> postRealName(@Body JsonObject jsonObject);

    @GET("config/handleStatus")
    Flowable<Response<Map<String, String>>> getTrachStatus();

    @GET("api/v/1.0/coins")
    Flowable<Response<List<CoinsBean>>> getCoinsTrans(@Query("page") int page, @Query("type") String type);

    @POST("api/v/1.0/order/track/{id}")
    Flowable<Response<List<Object>>> commitTrack(@Path("id") String id, @Body JsonObject jsonObject);

    @POST("api/v/1.0/order/refund/{id}")
    Flowable<Response<List<Object>>> commitRefund(@Path("id") String id, @Body JsonObject jsonObject);

    @GET("api/v/1.0/order/track_list/{id}")
    Flowable<Response<TrackListBean>> getTrackList(@Path("id") String id);

    @Multipart
    @POST("file/upload-img")
    Flowable<Response<CommonBean>> uploadImg(@Part("type") RequestBody typeBody
            , @Part("attatch_type") RequestBody tyBody2, @Part MultipartBody.Part file);

    @GET("api/v/1.0/order/refund_details/{id}")
    Flowable<Response<CsmOrderDetailBean>> getCsmDetail(@Path("id") String id);

    @POST("api/v/1.0/customers")
    Flowable<Response<CsmOrderListBean>> getCsmList(@Query("page") int page, @Body JsonObject jsonObject);

    @POST("api/v/1.0/order/pay/{id}")
    Flowable<Response<OrderPayResponseBean>> doPay(@Path("id") String id);

    @GET("api/v/1.0/order/payInfo/{path}")
    Flowable<Response<CsmPayInfo>> getCsmOrderInfo(@Path("path") String id);

    @POST("api/v/1.0/order/add/{path}")
    Flowable<Response<CommonBean>> doOrder(@Path("path") String id);

    @POST("api/v/1.0/auth/sms_codes")
    Flowable<Response<List<Object>>> getSmscode(@Body JsonObject jsonObject);

    @POST("api/v/1.0/auth/access_token")
    Flowable<Response<CommonBean>> loginUser(@Body JsonObject jsonObject);

    @POST("api/v/1.0/auth/refresh/access_token")
    Flowable<Response<CommonBean>> refreshToken();

    @GET("api/v/1.0/recharges")
    Flowable<Response<List<RechargesBean>>> getRecharges();

    @POST("api/v/1.0/alipay")
    Flowable<Response<TopOrderBean>> createOrder(@Body JsonObject jsonObject);

    @POST("api/v/1.0/sheets")
    Flowable<Response<OrderListBean>> getOrderList(@Query("page") int page, @Body JsonObject jsonObject);

    @GET("api/v/1.0/sheets/detail/{path}")
    Flowable<Response<OrderListBean.OrderList>> getOrderDetail(@Path("path") String id);

    @GET("api/v/1.0/my/my_index")
    Flowable<Response<UserInfoBean>> getUserInfo();

    @GET("api/v/1.0/home")
    Flowable<Response<BannerBean>> getBanners();

    @GET("api/v/1.0/share")
    Flowable<Response<InviteResponse>> getInviteInfo();

    @GET("api/v/1.0/share/list")
    Flowable<Response<InviteRecord>> getInviteList(@Query("page") int currentPage, @Query("status") String status);

    @POST("api/v/1.0/subscribe/order")
    Flowable<Response<String>> savePushParameters(@Body JsonObject jsonObject);

    @GET("api/v/1.0/subscribe/order")
    Flowable<Response<PushSettingBean>> getPushParameters();
}
